create or replace view vac_page_buttons as
with pb as (
select
 workspace,
 application_id,
 application_name,
 page_id,
 page_name,
 to_char(button_sequence) button_sequence,
 region,
 region_id,
 button_name,
 button_template,
 image_name,
 label,
 display_position,
 alignment,
 redirect_url,
 execute_validations,
 condition_type,
 condition_expression1,
 condition_expression2,
 image_attributes,
 button_attributes,
 database_action,
 build_option,
 authorization_scheme,
 authorization_scheme_id,
 last_updated_by,
 last_updated_on,
 component_comment,
 button_position,
 button_id
from APEX_APPLICATION_PAGE_BUTTONS t
)
select
 workspace,
 application_id,
 application_name,
 page_id,
 page_name,
 region_id,
 button_id,
 button_name,
 authorization_scheme_id,
 last_updated_by,
 last_updated_on,
 u_name,
 u_value,
 'APEX_APPLICATION_PAGE_BUTTONS' src_view_name
from pb
 UNPIVOT INCLUDE NULLS
 ( u_value
   FOR    u_name
   IN
   (   button_sequence,
       region,
       button_template,
       image_name,
       label,
       display_position,
       alignment,
       redirect_url,
       execute_validations,
       condition_type,
       condition_expression1,
       condition_expression2,
       image_attributes,
       button_attributes,
       database_action,
       build_option,
       authorization_scheme,
       component_comment,
       button_position
    )
 );

